import axios from '@/utils/request';

/**
 * 新增盘点单
 */
export async function AddCheckorder(params) {
    const res = await axios.post('/CheckOrder/AddCheckorder',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}


/**
 * 更新盘点单
 */
export async function UpdateCheckorder(params) {
    const res = await axios.post('/CheckOrder/UpdateCheckorder',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 获取盘点单查询分页列表
 */
 export async function QueryCheckorderByCondition(params) {
    const res = await axios.post('/CheckOrder/QueryCheckorderByCondition',params);
    if (res.data.code === 200) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.msg));
}


/**
 * 盘点单审核
 */
export async function AuitCheckorder(params) {
    const res = await axios.post('/CheckOrder/AuitCheckorder',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 盘点单反审核
 */
export async function AnitCheckorder(id) {
    const res = await axios.post('/CheckOrder/AnitCheckorder?id='+id);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 根据id获取盘点单
 */
 export async function QueryCheckorderById(id) {
    const res = await axios.get('/CheckOrder/QueryCheckorderById/'+id);
    if (res.data.code === 200) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.msg));
}


/**
 * 作废盘点单
 */
export async function DeleteCheckorder(id) {
    const res = await axios.post('/CheckOrder/DeleteCheckorder?id='+id);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}


